from prisma import Prisma
from functools import lru_cache as lruCache

prisma = Prisma()
isConnected = False

@lruCache()
def getPrisma() -> Prisma:
    """获取Prisma客户端实例"""
    return prisma

async def getPrismaClient() -> Prisma:
    """获取已连接的Prisma客户端实例"""
    global isConnected
    if not isConnected:
        await prisma.connect()
        isConnected = True
    return prisma 